<?php
require_once 'conf/conf.php';
class DataAccessHelper {

    /**
     * Ejecuta un comando SQL y devuelve el recurso (resource) correspondiente
     * @param string $SQLCommand
     * @return resource
     */
    public static function executeSQL($SQLCommand){
        $dbURL = Conf::$databaseURL;
        $dbName = Conf::$databaseName;
        $dbUsr = Conf::$databaseUName;
        $dbPwd = Conf::$databasePWord;

        $dbConn = mysql_connect($dbURL,$dbUsr,$dbPwd);
        $db = mysql_select_db($dbName,$dbConn);
        mysql_query("SET CHARACTER SET 'utf8'");
        mysql_query("SET collation_connection = 'utf8_spanish_ci'");
        $result = mysql_query($SQLCommand);

        if (mysql_errno()!=0){
            throw new Exception(mysql_error()." - ".$SQLCommand, "1");
        }
        return $result;
    }
}
?>